import { request } from '@inbiz/utils';

// 获取流程
export async function getProcessInfo(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getProcessDetails`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取搜索条件-流程
export async function getProcessList(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getCountByUserId`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 批量审批
export async function completeTask(params?: any) {
  return request(`/edoc2Flow-web/process/commonly/completeTask`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取指派
export async function getAssignList(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getAssigned`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 删除指派
export async function removeAssign(params?: any) {
  return request(`/edoc2Flow-web/process/external/cancelDelegates`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 我的归档
export async function getClassification(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyArchive`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取草稿
export async function getDraft(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getDepositDraft`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 删除草稿
export async function removeDraft(params?: any) {
  return request(`/edoc2Flow-web/process/operation/delDepositDraft`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 我的已办
export async function getHaveDone(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyComplete`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 我的申请  申请中
export async function getMyApply(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyInitiatorv6`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取待领任务
export async function getTasks(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyCandidateTasks`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 认领
export async function claimTasks(params?: any) {
  return request(`/edoc2Flow-web/process/operation/processClaim`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}
//取消指派
export async function cencelAssign(params: any) {
  return request(`/edoc2Flow-web/process/operation/processUnassign`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}
// 设置当前指派
export async function setTask(params: any) {
  return request(`/edoc2Flow-web/process/operation/processAssignment`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}
// 设置将来指派
export async function setFutureTask(params: any) {
  return request(`/edoc2Flow-web/process/operation/processFutrueAssignment`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 我的待办
export async function getMyToDo(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyInbox`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 抄送给我
export async function getToMe(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyCctome`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 将来指派列表
export async function getWillAssignList(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getFutureAssigned`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 删除将来指派
export async function removeFutureAssign(params?: any) {
  return request(`/edoc2Flow-web/process/operation/processDeleteAssignment`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取数字
export async function getProcessCenterNumber(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMenuCountByUserId`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 导出
export async function exportProcess(params?: any) {
  return request(`/edoc2Flow-web/process/external/processExport`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取流程分类
export async function saveProcessGroup(params: any) {
  return request(`/edoc2Flow-web/process/manageMent/saveOrUpGroupDpt`, {
    method: 'post',
    data: params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取申请列表
export async function getApplyList(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyApply`, {
    params,
  });
}

// 获取流程分类
export async function getApplyCategory(params: any) {
  return request(`/edoc2Flow-web/process/getResults/getCountByUserId`, {
    params,
  });
}

// 快速审批
export async function quickApproval(params: { assignee?: string; comment: string; taskIds?: string; processInstanceId?: string; }) {
  return request(`/edoc2Flow-web/process/operation/processBatchCompletion`, {
    method: 'post',
    data: {
      assignee: params?.assignee,
      comment: params?.comment,
      taskIds: params?.taskIds,
      processInstanceId: params?.processInstanceId,
    },
  });
}